<template>
    <view class="pages allPage back-fff">
        <view class="success">

            <view class="s-part">
                <uni-icons type="checkmarkempty" size="50" color="#ffffff"></uni-icons>
            </view>

        </view>

        <view class="name">
            <text class="fuhao">“</text>支付成功，等待配送<text class="fuhao">”</text>
        </view>

          <view class="text-center col-hui f26 mt20" @click="$goNext('/pages/center/order/detail?id='+orderId)">
                    <text>查看订单 ></text>
                </view>

       
        <view v-if="total >= 0" class=" partBox">
            <view class="commonTit">
                <view class="left">
                    <text class="tit">为您赠送一张礼券</text>
                </view>
            
            </view>

            <Ticket :listData='listData'></Ticket>
        </view>

        <LoadMask v-if="initMask" />

        <FollowWx/>

    </view>
</template>

<script>

import Ticket from '@/components/Ticket'
import FollowWx from '@/components/FollowWx'
const app = getApp();

export default {
    components: { Ticket , FollowWx },
    data () {
        return {
            initMask:false,
            //订单
            orderId: undefined,
           listData:[],
           total:0,

        }
    },
    onShow () {

        if(this.orderId){
            this.getTickFunc()
        }

    },
    onLoad (option) {

        // uni.removeStorageSync('addresId')
        this.orderId = option.orderId || '1706908570148503554'

        app.laterToken(bool => {

            this.userId = app.globalData.userId

            // this.initPage()


            app.logRecord('支付成功')
            if(this.orderId){
                this.getTickFunc()
            }

        })

    },
    mounted () {

    },
    methods: {
        initPage (cb) {

        },
        //获取券
        getTickFunc( cb){

            this.initMask = true

            let requireUrl =  'flash/supermarket/coupon/page/list?loading' 

            this.$axios({ url: requireUrl, data: {orderId:this.orderId,"pageNum": 1,"pageSize": 10,} })
                .then(res => {

                    // console.log('哈哈哈哈', res)

                    this.listData = res.data.map( item =>{
                        if(item.endTime){
                           item.endTimeShow =  item.endTime.split(' ')[0]
                        }
                        return item
                    })

                  
                    this.total = res.total

                    this.initMask = false

                    cb && cb()
                })
        }

    }
}
</script>

<style scoped lang="scss">

$mianColor: #eb4041;

.success{
    text-align: center;
    padding: 220rpx 0 40rpx;
    .s-part{
        margin: auto;
        width: 70px;
        height: 70px;
        line-height: 70px;
        border-radius: 45%;
        background:linear-gradient(to bottom, #adeb8c 10%,#72ce41 70%);
        font-size: 0;
    }

}
 .name {
    text-align: center;
    font-size: 40rpx;
    color: #565656;
    line-height: 1.5;
    font-weight: 400;
}
.partBox{
    padding-top: 150rpx;
    padding: 24rpx 30rpx;
}
.commonTit{
    overflow: hidden;
    padding: 30rpx 0 20rpx;
    line-height: 40rpx;
    .left{
        position: relative;
        float: left;
        padding-left: 16rpx;
        &::before{
            position: absolute;
            content: '';
            left: 0;
            width:8rpx;
            top: 50%;
            margin-top: -16rpx;
            height: 32rpx;
            background: linear-gradient(#f29a71, #ff2d46);
        }
        .tit{
            font-size: 30rpx;
            color:#565656;
            // font-weight: bold;
        }
    }
    .right{
        float: right;
        font-size: 26rpx;
        color:#999;
    }
}
</style>
